import axios from 'axios'
const baseUrl = "/myshop/"
function ajax_get(path, params = {}) {
    return axios.get(baseUrl + path, { params })
}

//一级分类
let getTypeOneList = ()=> ajax_get("getTypeOne")

//轮播图
let getBanner = () => ajax_get('banner');

//商品列表
let getGoodList = params => ajax_get("goodList", params);

//登录
let getLogin = params => ajax_get("login", params);

//注册
let getRegister = params => ajax_get("register", params)

//搜索
let getSearch = params => ajax_get("search", params)

//详情页
let getdetail = params => ajax_get("detail", params)

//商品推荐
var getSameGoods = params => ajax_get("sameList", params)

// 获取购物车数据
var getCartList = params => ajax_get("shopList", params)

// 购物车商品数量增加/添加购物车
var getCartAdd = params => ajax_get("add", params)

// 购物车商品数量减小
var getCartRemove = params => ajax_get("remove", params)

// 删除购物车商品
var getCartDelete = params => ajax_get("del", params)

export {
    getTypeOneList,
    getBanner,
    getGoodList,
    getLogin,
    getRegister,
    getSearch,
    getdetail,
    getSameGoods,
    getCartList,
    getCartAdd,
    getCartRemove,
    getCartDelete,
}